import Vue from 'vue';
import axios from './router/axios';
import VueAxios from 'vue-axios';
import App from './App';
import router from './router/router';
import './permission'; // 权限
import './error'; // 日志
import store from './store';
import { loadStyle } from './util/util'
import * as urls from '@/config/env';
import * as httpAction from '@/api/manage'
import Element from 'element-ui';
import VueClipboard from 'vue-clipboard2'
import Cookies from 'js-cookie'
import FormMaking from 'form-making'
import 'form-making/dist/FormMaking.css'
import {getDicts,formatDictText} from '@/util/zjmUtil'
let size = Cookies.get('size') || 'mini';
Vue.prototype.getDicts = getDicts
Vue.prototype.formatDictText = formatDictText
Object.keys(httpAction).forEach(key => {
    Vue.prototype[key] = httpAction[key]
})

Vue.use(VueClipboard)
Vue.use(FormMaking)
import {
    iconfontUrl,
    iconfontVersion
} from '@/config/env';
import i18n from './lang' // Internationalization
import './styles/common.scss';

import basicContainer from './components/basic-container/main'
import thirdRegister from './components/third-register/main'
import AvueFormDesign from '../packages/';
import formUserComponents from './components/formUserComponents';
import formUserSelect from './components/formUserComponents/userSelect';

Vue.use(AvueFormDesign)
Vue.use(formUserComponents)
Vue.use(formUserSelect)
Vue.use(router)
Vue.use(VueAxios, axios)
Vue.use(Element, {
   // i18n: (key, value) => i18n.t(key, value),
    size
})
// Vue.use(window.AVUE, {
//     i18n: (key, value) => i18n.t(key, value)
// })
//注册全局容器
Vue.component('basicContainer', basicContainer)
Vue.component('thirdRegister', thirdRegister);
// 加载相关url地址
Object.keys(urls).forEach(key => {
    Vue.prototype[key] = urls[key];
})

// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
    loadStyle(iconfontUrl.replace('$key', ele));
})

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount('#app')
